using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BookingDB.Models.Mapping
{
    public class PartBookingMap : EntityTypeConfiguration<EntityPartBooking>
    {
        public PartBookingMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            // Table & Column Mappings
            this.ToTable("PartBooking");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.show_Id).HasColumnName("show_Id");
            this.Property(t => t.isPaid).HasColumnName("isPaid");
            this.Property(t => t.booking_id).HasColumnName("booking_id");

            // Relationships
            this.HasOptional(t => t.Booking)
                .WithMany(t => t.PartBookings)
                .HasForeignKey(d => d.booking_id);
            this.HasOptional(t => t.Show)
                .WithMany(t => t.PartBookings)
                .HasForeignKey(d => d.show_Id);

        }
    }
}
